package com.yami.shop.personnft.common.service.impl;

import cn.hutool.core.util.IdUtil;
import com.yami.shop.bean.model.PersonnftTansferEnpand;
import com.yami.shop.common.bean.PageDTO;
import com.yami.shop.common.bean.PageVO;
import com.yami.shop.common.util.PageUtil;
import com.yami.shop.personnft.common.dao.NftTansferEnpandMapper;
import com.yami.shop.personnft.common.service.NftTansferEnpandService;
import com.yami.shop.personnft.common.vo.PersonnftTansferEnpandListDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 购物车
 *
 * @author FrozenWatermelon
 * @date 2020-11-20 15:47:32
 */
@Service
public class NftTansferEnpandServiceImpl implements NftTansferEnpandService {

    @Autowired
    private NftTansferEnpandMapper productTansferEnpandMapper;


    @Override
    public int deleteById(String id) {
        return productTansferEnpandMapper.deleteById(id);
    }

    @Override
    public int insertSelective(PersonnftTansferEnpand record) {
        record.setCreateTime(new Date());
        record.setId(IdUtil.getSnowflake().nextIdStr());
        return productTansferEnpandMapper.insertSelective(record);
    }

    @Override
    public int update(PersonnftTansferEnpand record) {
        record.setUpdateTime(new Date());
        return productTansferEnpandMapper.update(record);
    }

    @Override
    public PersonnftTansferEnpand getByProId(Long prodId) {
        return productTansferEnpandMapper.getByProId(prodId);
    }

    @Override
    public PersonnftTansferEnpand getByVarietyCode(String varietyCode) {
        return productTansferEnpandMapper.getByVarietyCode(varietyCode);
    }
    @Override
    public List<PersonnftTansferEnpand> getByVarietyCodes(List<String> varietyCodes) {
        return productTansferEnpandMapper.getByVarietyCodes(varietyCodes);
    }

    @Override
    public PersonnftTansferEnpand getById(String id) {
        return productTansferEnpandMapper.getById(id);
    }

    @Override
    public PageVO<PersonnftTansferEnpandListDto> getNftTansferEnpandList(PageDTO pageDTO, PersonnftTansferEnpandListDto nftTansferEnpandListDto) {
        return PageUtil.doPage(pageDTO, () -> productTansferEnpandMapper.getNftTansferEnpandList(nftTansferEnpandListDto));
    }
}
